<template>
	<view class="container">
		<freeGoodsList :listData="freeGoodsList.coupon_list"></freeGoodsList>
		<view class="col empty-view" v-if="freeGoodsList.coupon_list.length==0">
			<image :src="url+'/static/imgs/list-empty-common.png'"></image>
			<text class="empty-text">您还没有免费餐品券哦~</text>
			<view class="empty-button" @click="toGive">快去领券</view>
		</view>
	</view>
</template>

<script>
	var app = getApp();
	import freeGoodsList from '../../../components/freeGoodsList.vue';
	import http from '../../../common/js/request.js';
	export default {
		data() {
			return {
				url: app.globalData.baseImgUrl,
				store_id: app.globalData.storeId,
				freeGoodsList: [], //独家红包信息
			}
		},
		components: {
			freeGoodsList
		},
		onLoad() {
			var that = this;
			that.getFreeGoodsList();
		},
		methods: {
			//获取独家红包信息
			getFreeGoodsList() {
				var that = this;
				http.post('/api/v1/store/get_member_goods_gifts', {
					store_id: that.store_id
				}, res => {
					that.freeGoodsList = res.datas;
				});
			},
			toGive() {
				uni.switchTab({
					url: '/pages/store/give/home/home'
				})
			}

		}
	}
</script>

<style>
	/* 缺省样式 */
	.empty-view {
		margin-top: 183rpx;
		align-items: center;
		justify-content: center;
	}

	.empty-view image {
		width: 195rpx;
		height: 269rpx;
	}

	.empty-view .empty-text {
		margin-top: 80rpx;
		color: #333333;
		font-size: 36rpx;
	}

	.empty-view .empty-button {
		margin-top: 120rpx;
		width: 512rpx;
		height: 100rpx;
		background: rgba(255, 157, 17, 1);
		border-radius: 10rpx;
		font-size: 34rpx;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	/* 缺省样式 */
</style>
